package mini.reanimate;

import static bogus.core.BogusCore.egl;
import audio.Audio;
import owg.util.Calc;
import owg.util.opengl.BlendMode;
import owg.util.opengl.ColorF;

public class Only extends Screen{
	private int timer = 240;
	private final int screen = (int)Calc.random(3);

	public Only() {
		super(2, "only", "onlyover");
	}

	@Override
	public void step() {
		timer--;
		if (timer <= 0)
			Reanimate.me.setLevel(Reanimate.me.LEFT);
	}

	@Override
	public void enter() {
		Reanimate.me.BOGUS.invisible();
		Reanimate.me.off(0);
		Reanimate.me.off(1);
		Reanimate.me.off(2);
		Reanimate.me.off(3);
		Reanimate.me.BUSY = true;
		Reanimate.me.HUD = false;
		
		Audio.getClip("only").loop();
	}

	@Override
	public void leave() {
		Reanimate.me.BOGUS.visible();
		Reanimate.me.BUSY = false;
		Reanimate.me.HUD = true;
		Audio.getClip("only").stop();
		Reanimate.me.on(0);
	}

	@Override
	public boolean background() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void foreground() {
		sprite[0].render(screen, 432 + s[0].x, 243 + s[0].y, (float)(872.0 / 621.0), (float)(500.0 / 378.0), 0, ColorF.WHITE);
		egl.setBlendMode(BlendMode.ADD);
		sprite[1].render(0, 432 + s[1].x, 243 + s[1].y, (float)(872.0 / 590.0), (float)(500.0 / 300.0), 0, new ColorF(ColorF.WHITE, .1f));
		egl.setBlendMode(BlendMode.NORMAL_PRE);
	}

	@Override
	public void bogusLand() {
		// TODO Auto-generated method stub
		
	}

}
